/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;

/**
 *
 * @author Human Booster
 */
@Entity
@Table(name = "lifetime")
@NamedQueries({
    @NamedQuery(name = "Lifetime.findAll", query = "SELECT l FROM Lifetime l"),
    @NamedQuery(name = "Lifetime.findById", query = "SELECT l FROM Lifetime l WHERE l.id = :id"),
    @NamedQuery(name = "Lifetime.findByName", query = "SELECT l FROM Lifetime l WHERE l.name = :name")})
public class Lifetime implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "name")
    private String name;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "lifetime")
    private Collection<Licencesoftware> licencesoftwareCollection;

    public Lifetime() {
    }

    public Lifetime(Integer id) {
        this.id = id;
    }

    public Lifetime(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Collection<Licencesoftware> getLicencesoftwareCollection() {
        return licencesoftwareCollection;
    }

    public void setLicencesoftwareCollection(Collection<Licencesoftware> licencesoftwareCollection) {
        this.licencesoftwareCollection = licencesoftwareCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Lifetime)) {
            return false;
        }
        Lifetime other = (Lifetime) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Lifetime[ id=" + id + " ]";
    }
    
}
